import request from '@/utils/request'
import {AddRequest, ListRequest, RemoveRequest} from '@/interface/clients'

export const ClientListR = (req: ListRequest) => {
  return request({
    method: 'GET',
    url: '/client',
    params: req,
  })
}

//添加客户
export const ClientAddR = (req: AddRequest) => {
  const data = new FormData()
  data.set('name', req.name)
  return request({
    method: 'POST',
    url: '/client',
    data: data,
  })
}

//删除客户
export const ClientRemoveR = (req:RemoveRequest) => {
  return request({
    method: 'DELETE',
    url: `/client`,
    params: req
  })
}


//修改客户
export const ClientUpdateR = (req: AddRequest) => {
  console.log('修改客户表单:', req)
  return request({
    method: 'PUT',
    url: '/client',
    // data: data,
    data: JSON.stringify(req),
  })
}